#!/afs/psi.ch/user/b/braun_p/user/epd/bin/python

import sys

usage = """\
Usage:
%s reconstruction_file.h5 [dump_file]

Shows on screen a summary plot of a ptycho reconstruction.
If dump_file is specified, the plot is dumped instead (in a format
that depends on the extension - typically .png, .jpg, .pdf or .svg).
""" % sys.argv[0]

if len(sys.argv) not in [2,3]:
    print usage
    sys.exit(0)

import ptycho
from matplotlib import pyplot

p = ptycho.load_run(sys.argv[1])
P = ptycho.Plotter(interactive=False)
P.plot(p)
if len(sys.argv) > 2:
    P.savefig(sys.argv[2],dpi=300)
else:
    P.draw()

sys.exit(0)
